package com.edevp.common.core.util.properties;

import java.io.IOException;
import java.util.Properties;

/**
 * 资源文件类型
 *
 * @author Lean
 * @create 2020-02-28 3:37 PM
 **/
public class PropertiesUtil {
	public static final String UPLOAD_CONFIG="upload.properties";
	public static final String DATABASE="db.properties";
	public static final String CONFIG="config.properties";

	public static String getValue(String propertiesFile,String key){
		Properties p = getProperties(propertiesFile);
		String fileDir = p.getProperty(key);
		return fileDir;
	}

	public static Properties getProperties(String propertiesFile){
		Properties p = null;
		try {
			System.out.println("----propertiesFile----"+propertiesFile);
			p = JProperties.loadProperties(propertiesFile, JProperties.BY_CLASSLOADER);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return p;
	}

	public static String getDatabaseValue(String key){
		return getValue(DATABASE,key);
	}
}
